package biz.bbtec.sbm.timing.action;
import java.util.Timer; 
import javax.servlet.ServletContextEvent; 
import javax.servlet.ServletContextListener; 
import javax.servlet.http.HttpServlet; 

import biz.bbtec.sbm.mytask.action.MyTask;
public  class ContextListener extends HttpServlet implements ServletContextListener{
	public ContextListener() { 
}
	private Timer timer = null; 
	
	public void contextInitialized(ServletContextEvent event) { 
		timer = new Timer(true);
	event.getServletContext().log("定时器已启动"); 
	new MyTask();                //调用task,执行任务
	event.getServletContext().log("已经添加任务调度表"); 
	} 
	
	public void contextDestroyed(ServletContextEvent event) { 
	timer.cancel(); 
	event.getServletContext().log("定时器销毁"); 
	} 

}


